package com.kaifamiao.contraller;

import com.kaifamiao.model.YymanagerModel;
import com.kaifamiao.service.YymanagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
@RequestMapping(value = "/manager")
public class YymanagerController {

    @Autowired
    private YymanagerService service;

    @RequestMapping("/find")
    public ModelAndView find(){

        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg",service.findById(1L));
        modelAndView.setViewName("/WEB-INF/success.jsp");
        return modelAndView;
    }

    @RequestMapping("/findAll")
    public ModelAndView findAll(){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("msg",service.findAll());
        modelAndView.setViewName("/WEB-INF/success.jsp");
        return modelAndView;
    }
    @RequestMapping("/vue")
    public ModelAndView modelAndView(){
        ModelAndView view = new ModelAndView();
        view.addObject("msg","请求成功!");
        view.setViewName("/WEB-INF/success.jsp");
        return view;
    }
}
